const { responseWrite } = require('./common')

const hasAuth = (req, res, next) => {
    if( req.session.username ){
        responseWrite(res, {message: "已登录"})
    }else{
        responseWrite(res, {message: "尚未登录, 请登录"}, 300)
    }
}

const auth = (req, res, next) => {
    if( req.session.username ){
        next()
    }else{
        responseWrite(res, {message: "尚未登录, 请登录"}, 300)
    }
}

module.exports = {
    hasAuth, auth
}








